<template>
    <h3>每周上新</h3>
    <div id="outer">
        <ul>
            <li v-for="item of goodsList" :key="item.id" @click="jumpXiaDan(item)">
                <img :src="item.imgUrl" alt="">
                <div class="name">
                    {{item.name}}}
                </div>
                <div class="price">
                    <span class="youHui">￥{{item.newprice}}</span>
                    <span class="yuanJia" v-if="item.price!==null">￥{{item.price}}</span>
                </div>
            </li>
        </ul>
    </div>
</template>

<script>
    import {getBanner} from "../../../../api";

    export default {
        name: "XinPinShouFaMeiZhouShangXinzxw",
        data(){
            return{
                goodsList:null
            }
        },
        mounted() {
            getBanner('/homexinpinshoufa-meizhoushangxin')
                .then(response=>{
                    this.goodsList = response.data
                })
        },
        methods:{
            jumpXiaDan(item){
                this.$router.push({path:'/xiadan-view',query:item})
            }
        }
    }
</script>

<style scoped>
    h3{
        margin-left: 2.5%;
    }
    #outer{
        width: 95%;
        height: 180px;
        margin: 10px auto;
        overflow: scroll;
        position: relative;
    }
    #outer::-webkit-scrollbar{
        display: none;
    }
    ul{
        width: 1425px;
        height: 100%;
        position: relative;
    }
    li{
        width: 85px;
        height: 100%;
        float: left;
        margin-right: 10px;
        position: relative;
    }
    img{
        width: 100%;
    }
    .name{
        display: inline-block;
        width: 90%;
        margin: 0 auto;
        font-size: 12px;
        height: 30px;
        word-wrap: break-word;
        text-overflow: ellipsis;
        display:-webkit-box;
        -webkit-box-orient:vertical;/*设置方向*/
        -webkit-line-clamp:2;/*设置超过为省略号的行数*/
        overflow:hidden;
    }
    .price{
        width: 100%;
        position: absolute;
        bottom: 10px;
    }
    .youHui{
        font-size: 14px;
        font-weight: bold;
        color: red;
    }
    .yuanJia{
        font-size: 12px;
        color: #7f7f7f;
        text-decoration: line-through;
    }
</style>